<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="renderer" content="webkit"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>中原驾考</title>
    <link rel="stylesheet" href="__PUBLIC__/app/assets/css/light7.min.css">
    <link rel="stylesheet" href="__PUBLIC__/app/assets/css/common.css">
    <script type="text/javascript" src="__PUBLIC__/app/lib/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/app/lib/vue.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/layer/skin/default/layer.css">
    <script type="text/javascript">$.config={router:!1}</script>
    <script type="text/javascript" src="__PUBLIC__/app/lib/light7/js/light7.min.js"></script>
</head>
<body>
<div class="page-group">
    <div class="page page-current">
        <header class="bar bar-nav search">
            <form class="form-inline">
                <i class="icon icon-menu fr" onclick="showAddress()"></i>
                <input type="text" name="keyword" value="{:I('keyword')}" onblur="index_list()" class="form-control" placeholder="请输入搜索驾校名">
                <a class="button button-link button-nav pull-left back" href="javascript:window.history.go(-1)">
      <span class="icon icon-left"></span>
    </a>
            </form>
        </header>
<div class="address-list" style="display: none;">
    <ul>
        <li>北京</li>
        <li>郑州</li>
        <li>上海</li>
        <li>广州</li>
        <li>北京</li>
        <li>郑州</li>
        <li>上海</li>
        <li>广州</li>
        <li>北京</li>
        <li>郑州</li>
        <li>上海</li>
        <li>广州</li>
        <li>北京</li>
        <li>郑州</li>
        <li>上海</li>
        <li>广州</li>
        <li>北京</li>
        <li>郑州</li>
        <li>上海</li>
        <li>广州</li>
        
    </ul>
</div>
        <div class="content">
            <div class="ds-title">
                <ul>
                    <li class="bgc sel" style="margin-left:48%;" onclick="location.reload();"><i class="icon icon-code"></i>&nbsp;推荐</li>
                    <!-- <li class="sel"><i class="icon icon-list"></i>&nbsp;距离</li> -->
                    <li class="sel" onclick="index_list()"><i class="icon icon-caret"></i>&nbsp;价格</li>
                </ul>
                <span id='cityName'>郑州驾校</span>
            </div>
            <div class="list-block media-list ds-list">
                <ul id='list_jx'>
                    <foreach name="list" item="val">
                        <li>
                            <a href="{:U('School/info',array('uid'=>$val['uid']))}" class="item-link item-content">
                                <div class="item-media ds-list-img">
                                    <img src="{$val['head']}">
                                </div>
                                <div class="item-inner">
                                    <div class="item-title-row">
                                        <div class="item-title">{$val['name']}</div>
                                        <div class="item-after">
                                            <span class="money">￥{$val['price']}</span>
                                        </div>
                                    </div>
                                    <div class="item-subtitle">地址：
                                        <?php echo mb_substr($val['address'],0,10, 'utf-8'). '...'; ?>
                                    </div>
                                    <div class="item-text">详细</div>
                                </div>
                            </a>
                        </li>
                    </foreach>
                     <input type="hidden" name="status" id="status" value="{$status}">

                </ul>
                <input type="hidden" name="city_where" id="city_where" value="">
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.sel').click(function(){
        $('.sel').removeClass('bgc');
        $(this).addClass('bgc');
    });
index_list();
function index_list(city,city_name){
    if(city){
        $('#city_where').val(city);
    }else{
        var city = $('#city_where').val();
    }
    $('.address-list').hide();
    var keyword = $('.form-control').val();
    var sort = $('#sort').val();
    var status = $('#status').val();
    if(sort == 'desc'){
        sort = 'asc';
        $('.icon-caret').css("transform","rotate(180deg)");
    }else{
        sort = 'desc';
        $('.icon-caret').css("transform","rotate(0deg)");
    }
    $.ajax({
      url:"{:U('index_ajax')}",
      type:'post',
      data:{keyword:keyword,sort:sort,status:status,city:city},
      success:function(res){
        if(res == 1){
             $('#city_where').val('');
             layer.msg('该城市下没有驾校',{time:1000});
        }else{
            $('#cityName').html(city_name);
            $('#list_jx').html(res);
            //$('.icon-caret').css("transform","rotate(180deg)");
        }
      }
  });
}
function showAddress(){
    $('.address-list').show();
    getCity();
}

function getCity(){
    var status = $('#status').val();
    $.ajax({
      url:"{:U('getCity')}",
      type:'post',
      data:{status:status},
      success:function(res){
    	  $('.address-list').html(res);
      }
  });
}
</script>
</body>
</html>